package com.alxbrendmaquinarias.controller;

import com.alxbrendmaquinarias.model.Employee;
import com.alxbrendmaquinarias.util.faces.FacesUtil;
import java.io.Serializable;
import org.omnifaces.util.Faces;

import org.springframework.stereotype.Controller;

@Controller
public class NavigationController implements Serializable {

    private static final long serialVersionUID = 1L;

    private String navigationContent = "./pages/home.xhtml";
    private String navigationMenu;

    public String getNavigationContent() {
        return navigationContent;
    }

    public void setNavigationContent(String navigationContent) {
        this.navigationContent = navigationContent;
    }

    public String getNavigationMenu() {
        Employee employee = (Employee)Faces.getSessionAttribute(FacesUtil.ATTRIBUTE_USER);
        if(employee.getRole().equals(Employee.ADMINISTRADOR)){
            setNavigationMenu("./pages/import/menu-role/menu-left-administrator.xhtml");
        } else if(employee.getRole().equals(Employee.ALMACENERO)){
            setNavigationMenu("./pages/import/menu-role/menu-left-store-house.xhtml");
        } else if(employee.getRole().equals(Employee.VENDEDOR)){
            setNavigationMenu("./pages/import/menu-role/menu-left-seller.xhtml");
        }
        return navigationMenu;
    }

    public void setNavigationMenu(String navigationMenu) {
        this.navigationMenu = navigationMenu;
    }

}
